Skip to content

Conversation

@jsternberg
Copy link
Collaborator

@jsternberg jsternberg commented Oct 15, 2025

This subrequest is similar to buildctl debug dump-llb but works on a
running buildkit daemon with the dockerfile frontend. The
--call=convertllb option can be used to dump the raw LLB along with the
metadata and anything else in the definition to a JSON format.

This is useful for debugging purposes.

@jsternberg
Copy link
Collaborator Author

I wasn't sure whether this would be good as a PR but I've now used it for debugging two issues related to dockerfile so I figured it might be worth adding.

"google.golang.org/protobuf/encoding/protojson"
)

const RequestDumpLLB = "frontend.dumpllb"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "convertllb", or just "llb" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

if err != nil {
return nil, err
}
res.AddMeta("result.json", dt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does buildx still print this out correctly by default if there is no result.txt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does.

@tonistiigi
Copy link
Member

tonistiigi commented Oct 17, 2025

One thing that is slightly weird about this is that we are leaving the responsibility of returning llb structure for the frontend, while technically, buildkit already knows about the LLB frontend that has generated, so it could do it for any frontend automatically, without the frontend itself needing to do anything special.

This subrequest is similar to `buildctl debug dump-llb` but works on a
running buildkit daemon with the dockerfile frontend. The
`--call=convertllb` option can be used to dump the raw LLB along with the
metadata and anything else in the definition to a JSON format.

This is useful for debugging purposes.

Signed-off-by: Jonathan A. Sternberg <[email protected]>
@jsternberg jsternberg changed the title dockerfile: add subrequest for dumping LLB contents for dockerfile dockerfile: add subrequest for converting LLB contents for dockerfile Oct 21, 2025
@tonistiigi tonistiigi merged commit b548172 into moby:master Oct 23, 2025
169 of 170 checks passed
@jsternberg jsternberg deleted the dumpllb-subrequest branch October 23, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants